#include<iostream>
using namespace std;
int main()
{int n,m,a,b,c,d;
 cin>>n;
 for(int i=1;i<=n;i++)
    {cin>>m;
     a=m/25;
     m=m%25;
     b=m/10;
     m=m%10;
     c=m/5;
     m=m%5;
     d=m;
     cout<<i<<" "<<a<<" QUARTER(S), "<<b<<" DIME(S), "<<c<<" NICKEL(S), "<<d<<" PENNY(S)"<<endl;
     }
 system("pause");
 return 0;
}
